package com.t.bricks.bussiness.service.workovertimeapply.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.t.bricks.bussiness.db.dao.workovertimeapply.WorkOvertimeApplyDao;
import com.t.bricks.bussiness.db.entity.workovertimeapply.WorkOvertimeApply;
import com.t.bricks.bussiness.service.workovertimeapply.WorkOvertimeApplyService;
import com.t.bricks.model.MsgEmity;

/**
 * 加班申请'WorkOvertimeApply表'基本业务操作类接口实现
 */
@Service
public class WorkOvertimeApplyServiceImpl implements WorkOvertimeApplyService<WorkOvertimeApply> {

	@Autowired
	private WorkOvertimeApplyDao<WorkOvertimeApply> workOvertimeApplyDao;
	
	/**
	 * 修改状态
	 * @param sId 编号
	 * @param iState 状态值
	 * @param iVersion 记录版本号
	 * @param sMemo 备注
	 * @return MsgEmity 返回执行情况
	 */
	@Override
	public MsgEmity changeState(String sId, Integer iState, Integer iVersion, String sMemo) {
		if (null == sId || "".equals(sId.trim())) {
			return new MsgEmity(false, "编号不能为空！", 8001);
		}
		
		if (null == iState) {
			return new MsgEmity(false, "状态值不能为空！", 8002);
		}
		
		if (null == iVersion || iVersion.intValue() < 1) {
			return new MsgEmity(false, "版本号不该小于1！", 8003);
		}
		
		return workOvertimeApplyDao.changeState(sId, iState, iVersion, sMemo);
	}

}
